﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Sda.Reporting.Contracts;

namespace Boa.AIT.Web.Reportes
{
    public partial class VerReporte : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string temp = Request["param"];
                string param = System.Web.HttpUtility.UrlDecode(temp);
                Dictionary<string, string> parameters = Didsoft.Mvc.Security.DicParams.TranslateParam(param);

                IReportRender reporte = (IReportRender)Didsoft.Core.Reflection.InstanciateObjectFromAssembly(parameters[Boa.AIT.Reportes.Raiz.Parametros.Renderizador]);
                reporte.Parameters = parameters;
                var bytes = reporte.RenderReport();
                Response.ContentType = bytes.MimeType;
                Response.BinaryWrite(bytes.Content);
            }
        }
    }
}